<%@ page language="java" import="java.util.*,shopping.*,database.*" pageEncoding="gb2312"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>My JSP 'save.jsp' starting page</title>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
  <%System.out.println("save.jsp------>"); %>
  
     <%
       Cart cart = (Cart)session.getAttribute("cart");
      // System.out.println(cart);
       if (cart == null)
       {
         session.removeAttribute("cart");
         System.out.println("### 0" + " in save.jsp");
         response.sendRedirect("show_cart?state=0");
         return ;
       }
       String customerId = (String)session.getAttribute("customerId");
       int state = new InputData().updateOrders(customerId,cart,true);
       session.removeAttribute("cart");
       System.out.println(state + " in save.jsp");
       response.sendRedirect("show_cart.jsp?state="+state);
      %>
  </body>
</html>
